package org.example.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @description:
 * @author: 谢超
 * @date: 2024/8/15 16:24
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "pay.wechat")
public class WeChatPayConfig {

    /**
     * 商户号
     */
    private String mchId;

    /**
     * 公众号id
     */
    private String wxPayAppid;

    /**
     * 商户证书序列号
     */
    private String mchSerialNo;

    /**
     * api密钥
     */
    private String apiV3Key;

    /**
     * 商户私钥路径
     */
    private String privateKeyPath;

    /**
     * 支付成功页面跳转
     */
    private String successReturnUrl;

    /**
     * 支付成功，回调通知
     */
    private String callbackUrl;

    public static class Url {
        /**
         * native下单接口
         */
        public static final String NATIVE_ORDER = "https://api.mch.weixin.qq.com/v3/pay/transactions/native";
        public static final String NATIVE_ORDER_PATH = "/v3/pay/transactions/native";

        /**
         * native订单查询接口，根据商户订单号查询
         */
        public static final String NATIVE_QUERY = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/%s?mchid=%s";
        public static final String NATIVE_QUERY_PATH = "/v3/pay/transactions/out-trade-no/%s?mchid=%s";

        /**
         * native订单关单服务接口
         */
        public static final String NATIVE_CLOSE = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/%s/close";
        public static final String NATIVE_CLOSE_PATH = "/v3/pay/transactions/out-trade-no/%s/close";
    }

}
